﻿package app.controller {
    
    import flash.display.DisplayObject;
    
    import org.puremvc.interfaces.*;
    import org.puremvc.patterns.command.*;
    import org.puremvc.patterns.observer.*;
    
    import app.model.*;
    import app.view.ApplicationMediator;
    import app.ApplicationFacade;

    /**
     * Create and register proxies and mediators
     */
    public class StartupCommand extends SimpleCommand
    {
        override public function execute( note:INotification ) :void    
        {  
            
            // body of notification is our Main movieclip
            var root:Main = (note.getBody() as Main);
            
        
            // register proxies
            
            // view state proxy (manages application view state)
            facade.registerProxy( new StateProxy() );
            
            // proxy to our remote services
            facade.registerProxy( new RemoteProxy() );
            
            
            // register top-level mediator
            //-----------------------------
            
            facade.registerMediator( new ApplicationMediator( root ) );    
            
       }
    }
}